package com.logica.mdm.webservices.utils;
import javax.xml.bind.DatatypeConverter;
import java.util.Date;
import java.util.GregorianCalendar;

public class CustomDataTypeAdapter {
	public static Date parseDate(String date) {
        return DatatypeConverter.parseDate(date).getTime();
    } 

    public static String printDate(Date date) {
        final GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        return DatatypeConverter.printDate(calendar);
    } 

    public static Date parseDateTime(String date) {
        return DatatypeConverter.parseDateTime(date).getTime();
    } 

    public static String printDateTime(Date date) {
        final GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        return DatatypeConverter.printDateTime(calendar);
    }
}
